<template>
  <HomePanel ref="target" title="人气推荐" sub-title="人气爆款 不容错过">
    <!--  <ul class="goods-list">
      <li v-for="item in goods" :key="item.id">
        <RouterLink to="/">
          <img :src="item.picture" alt="" />
          <p class="name">{{ item.title }}</p>
          <p class="desc">{{ item.alt }}</p>
        </RouterLink>
      </li>
    </ul> -->
    <HomeLi :list="newData"></HomeLi>
    <template #right>
      <xtx-more></xtx-more>
    </template>
  </HomePanel>
</template>

<script>
import HomePanel from './home-panel'
import HomeLi from './home-li.vue'
import { findHot } from '@/api/home'
import { ref } from 'vue'
// 引入可视区域监控钩子函数
import { useObserve } from '@/hook'
export default {
  name: 'HomeHot',
  components: { HomePanel, HomeLi },
  setup () {
    const newData = ref([])
    async function getNew () {
      const { result } = await findHot()
      newData.value = result
    }
    const { target } = useObserve(getNew)
    return { newData, target }
  }
}
</script>
